package com.zrwl.poscloud.commons.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zrwl.poscloud.commons.validator.annotion.IntegerNotNull;
import com.zrwl.poscloud.commons.validator.group.Delete;
import com.zrwl.poscloud.commons.validator.group.Update;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * BaseVO   view object 表现层 基类对象
 *
 * @author: liusitong
 * @create: 2019-12-03-22:38
 */
@Data
public class BaseVOForUidToInt<T> extends PageInfo<T> {

    /**
     * 唯一UID
     */
    @IntegerNotNull(groups = {Update.class, Delete.class})
    private Integer uid;

    private Integer status;
    /**
     * @TableField 配置需要填充的字段
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createTime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public BaseVOForUidToInt() {
        this.createTime = new Date();
        this.updateTime = new Date();
    }
}
